/*
 * @Author: 吕佳伟
 * @Date: 2021-04-08 17:07:34
 * @LastEditors: 吕佳伟
 * @LastEditTime: 2021-07-03 21:37:15
 * @Description: file content
 */
import 'package:flutter/material.dart';
import './connections.dart';
import '../models/ClassResponseData.dart';
import '../widgets/class_item_widget.dart';
import '../utils/ClassRefactorData.dart';
import '../models/ClassItemViewModel.dart';

///获取一日课程信息类
///吕佳伟、孙焰明
Future<List<Widget>> getOneDaylessons(
    String date, String studentId, String token) async {
  ClassResponseData response =
      await getTimeTableFromStudentID(studentId, token);
  List<ClassItemViewModel> datas = getADayClasses(response);

  List temp = datas
      .map((e) {
        if (e.date == date) {
          return ClassItem(data: e);
        }
      })
      .toList()
      .where((element) => element != null)
      .toList();
  return temp;
}
